package main

import (
	"flag"
	"os"
)

func main() {
	//获取命令行参数
	println(len(os.Args))
	for i, v := range os.Args {
		println(i, v)
	}

	//接收-u root -p 123456 -P 3306
	var user string
	var pwd string
	flag.StringVar(&user, "u", "", "获取用户名")
	flag.StringVar(&pwd, "u", "", "获取密码")
	flag.Parse() //需要转换
	println(user, pwd)
}
